package com.hq.ims.data.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.hq.ims.data.vo.CompanyDepartmentMapstruct;
import com.hq.mybatis.base.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 蒋柏平
 * @since 20240927
 */
@Data
@Alias("CompanyDepartment")
@TableName(value = "company_department")
@ApiModel(value = "公司部门", description = "公司部门")
public class CompanyDepartment extends BaseModel<CompanyDepartment> implements Serializable {

    @ApiModelProperty(value = "主键")
    @TableId(value = "company_department_id", type = IdType.ASSIGN_UUID)
    private String companyDepartmentId;

    @ApiModelProperty(value = "创建时间 - 不需程序员处理")
    @TableField(value = "create_date_time", fill = FieldFill.INSERT)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDateTime;

    @ApiModelProperty(value = "更新时间 - 不需程序员处理")
    @TableField(value = "update_date_time", fill = FieldFill.INSERT_UPDATE)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateDateTime;

    @ApiModelProperty(value = "创建用户名称")
    @TableField(value = "create_user_name", fill = FieldFill.INSERT)
    private String createUserName;

    @ApiModelProperty(value = "更新用户名")
    @TableField(value = "update_user_name", fill = FieldFill.INSERT_UPDATE)
    private String updateUserName;

    @ApiModelProperty(value = "乐观锁 - 不需程序员处理")
    @TableField(value = "version")
    @Version
    private Integer version;

    @ApiModelProperty(value = "公司ID")
    @TableField(value = "company_id")
    private String companyId;

    @ApiModelProperty(value = "公司名称")
    @TableField(value = "company_name")
    private String companyName;

    @ApiModelProperty(value = "部门名称")
    @TableField(value = "company_department_name")
    private String companyDepartmentName;

    @ApiModelProperty(value = "是否删除")
    @TableField(value = "is_del")
    @TableLogic
    private Boolean isDel;

    public CompanyDepartmentMapstruct.CompanyDepartmentRowAuthVo auth() {
        CompanyDepartmentMapstruct.CompanyDepartmentRowAuthVo auth = new CompanyDepartmentMapstruct.CompanyDepartmentRowAuthVo(this);
        return auth;
    }

}
